<?php

App::uses('AppModel', 'Model');

class Bank extends AppModel {

    var $name = 'Bank';
    
    public $hasMany = array(
        'BankBranch' => array(
            'className' => 'BankBranch',
            'foreignKey' => 'bank_id',
            'conditions' => '',
            'fields' => '',
            'order' => ''
        ),
        'BankCreditAuthorization' => array(
            'className' => 'BankCreditAuthorization',
            'foreignKey' => 'bank_id',
            'conditions' => '',
            'fields' => '',
            'order' => ''
        ),
        'BankReversalAuthorization' => array(
            'className' => 'BankReversalAuthorization',
            'foreignKey' => 'bank_id',
            'conditions' => '',
            'fields' => '',
            'order' => ''
        ),
        'Transaction' => array(
            'className' => 'Transaction',
            'foreignKey' => 'bank_id',
            'conditions' => '',
            'fields' => '',
            'order' => ''
        ),
        'FeeTypeAccount' => array(
            'className' => 'FeeTypeAccount',
            'foreignKey' => 'bank_id',
            'conditions' => '',
            'fields' => '',
            'order' => ''
        ),
        'FeeType' => array(
            'className' => 'FeeType',
            'foreignKey' => 'bank_id',
            'conditions' => '',
            'fields' => '',
            'order' => ''
        )
    );

    public function save($data = null,$validate = true, $fieldList = array()) {
        $s = $this->sanitize($data);
        return parent::save($s);
    }

    function getBanksIds(){
        return $this->find('list',array(
            'fields'=>array('id'),
            'recursive'=>-1
        ));
    }
}